Index
This describes the structure of the Events section. |
---|
Overview |
Versioned Changes |
Randomize Node |
Sequence Node |
Trigger |
Add Component Group |
Remove Component Group |
Set Entity Property |
Queue Command |
Entity events can be structured by a combination of sequence
and randomize
nodes.
sequence
nodes are array nodes and will execute all entries in order from first element to last.randomize
nodes are array nodes that will pick one entry to execute, based on a weight.filters
can also be added within sequence
and randomize
nodes to restrict execution.Within randomize
and sequence
nodes, you can specify operations such as:
trigger
- Fire additional entity events when an event is hit.add
- Add component groups to your entity.remove
- Remove component groups from your entity.When an event is received, its effects are determined immediately, but changes are applied during the next tick on the server side of the game. This can affect subsequent filters in a sequence
array or timing when events are sent between entities.
A format_version
of 1.19.20
or higher is required to properly evaluate filters specified at the root level of an event definition. Content with a lower version will use the old behavior, which ignores root-level filters.
The randomize
node is an array node that will pick one entry to execute based on a weight. If no weight is specified, a node will have a default weight of 1.0
.
Example:
Example:
Triggers additional entity events when hit. For example, you could use a randomize
node in minecraft:entity_spawned
to choose either an adult or baby event for adding component groups.
Example:
Adds component groups to the current entity. Components in a group being added will replace previously added components if they are of the same type.
Example:
Removes component groups from the current entity. The groups must be defined in the component_groups
section of the file.
Example:
Sets the value of an entity property. The property must be defined in the properties
section of the file.
Example:
Queues a command to be run on the entity. The command will run within the next tick unless the entity has been removed.
Example: